{include file="header.tpl"}
<link href="{$smarty.const.CSS}css.css" type="text/css" rel="stylesheet" />
<link href="{$smarty.const.CSS}default/style.css" type="text/css" rel="stylesheet" />
<link href="{$smarty.const.CSS}markitup/style.css" type="text/css" rel="stylesheet" />
<link href="{$smarty.const.CSS}jquery-ui-1.7.3.custom.css" type="text/css" rel="stylesheet" />
<style>
	.feedback { font-size: 1.4em; }
	.selectable .ui-selecting { background: #FECA40; }
	.selectable .ui-selected { background: #F39814; color: white; }
	.selectable { list-style-type: none; margin: 0; padding: 0; }
	.selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px;float: left;}
	input { 	width: 300px;}
	textarea { border: 1px solid #D4D0C8;  width: 300px; height:100px; }
	</style>
<script type="text/javascript" src="{$smarty.const.JS}jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="{$smarty.const.JS}jquery-ui-1.7.3.custom.min.js"></script>
<script type="text/javascript" src="{$smarty.const.JS}jquery.markitup.js"></script>
<script type="text/javascript" src="{$smarty.const.JS}set.js"></script>
</head>
<BODY>

<div class="kuang" backgroundcolor="#99ccff">

{if $smarty.get.id}
<span>品牌属性修改</span>&nbsp;<br/>
<form action="brand.php?id={$smarty.get.id}" method="post" >
{else}
<span>品牌属性添加</span>&nbsp;<br/>
<form action="brand.php" method="post" >
{/if}
<table>
<tr><td>英文名:</td><td><input type="hidden" name="name_en" id="name_en-value" value="{$brand_text.name_en}" />
<ol id="name_en-selectable" class="selectable">
{foreach $brand as $value}
{if $value.belongto eq 'name_en'}
<li class="ui-widget-content" valueid="{$value.id}">{$value.typename}</li>
{/if}
{/foreach}
</ol>
<script type="text/javascript">
	$(function() {
		$( "#name_en-selectable" ).selectable({
			stop: function() {
				$( ".ui-selected", this ).each(function() {
					var index = $( "#name_en-selectable li" ).index(this);
					var valueid=$( "#name_en-selectable li:eq("+index+")" ).attr("valueid");
					$("#name_en-value").removeAttr("value");
					$("#name_en-value").attr("value",valueid);
				});
			}
		});
		
		
		
	});
	
	$(function() {
	$( "#name_en-selectable li", this ).each(function() {
		var index = $( "#name_en-selectable li" ).index(this);
			var value=$("#name_en-value").attr("value");
			if ( value == $( "#name_en-selectable li:eq("+index+")" ).attr("valueid") )
				{ 
				$( "#name_en-selectable li:eq("+index+")" ).addClass("ui-selected"); 
				}
		});			
	});
	</script>

</td></tr>
<tr><td>中文名:</td><td><input type="hidden" name="name_cn" id="name_cn-value" value="{$brand_text.name_cn}" />
<ol id="name_cn-selectable" class="selectable">
{foreach $brand as $value}
{if $value.belongto eq 'name_cn'}
<li class="ui-widget-content" valueid="{$value.id}">{$value.typename}</li>
{/if}
{/foreach}
</ol>
<script>
	$(function() {
		$( "#name_cn-selectable" ).selectable({
			stop: function() {
				$( ".ui-selected", this ).each(function() {
					var index = $( "#name_cn-selectable li" ).index(this);
					var valueid=$( "#name_cn-selectable li:eq("+index+")" ).attr("valueid");
					$("#name_cn-value").attr("value",valueid);
				});
			}
		});
	});
	$(function() {
	$( "#name_cn-selectable li", this ).each(function() {
		var index = $( "#name_cn-selectable li" ).index(this);
			var value=$("#name_cn-value").attr("value");
			if ( value == $( "#name_cn-selectable li:eq("+index+")" ).attr("valueid") )
				{ 
				$( "#name_cn-selectable li:eq("+index+")" ).addClass("ui-selected"); 
				}
		});			
	});
	</script>
</td></tr>

<tr><td>别名1:</td><td><input type="text" name="nickname1" value="{$brand_text.nickname1}"/></td></tr>
<tr><td>别名2:</td><td><input type="text" name="nickname2" value="{$brand_text.nickname2}"/></td></tr>

<tr><td>档次:</td><td><input type="hidden" name="level" id="level-value" value="{$brand_text.level}" />
<ol id="level-selectable" class="selectable">
{foreach $brand as $value}
{if $value.belongto eq 'level'}
<li class="ui-widget-content" valueid="{$value.id}">{$value.typename}</li>
{/if}
{/foreach}
</ol>
<script>
	$(function() {
		$( "#level-selectable" ).selectable({
			stop: function() {
				$( ".ui-selected", this ).each(function() {
					var index = $( "#level-selectable li" ).index(this);
					var valueid=$( "#level-selectable li:eq("+index+")" ).attr("valueid");
					$("#level-value").attr("value",valueid);
				});
			}
		});
	});
	$(function() {
	$( "#level-selectable li", this ).each(function() {
		var index = $( "#level-selectable li" ).index(this);
			var value=$("#level-value").attr("value");
			if ( value == $( "#level-selectable li:eq("+index+")" ).attr("valueid") )
				{ 
				$( "#level-selectable li:eq("+index+")" ).addClass("ui-selected"); 
				}
		});			
	});
	</script>
</td></tr>

<tr><td>产品线:</td><td><input type="hidden" name="product_line" id="product_line-value" value="{$brand_text.product_line}" />
<ol id="product_line-selectable" class="selectable">
{foreach $brand as $value}
{if $value.belongto eq 'product_line'}
<li class="ui-widget-content" valueid="{$value.id}">{$value.typename}</li>
{/if}
{/foreach}
</ol>
<script>
	$(function() {
		$( "#product_line-selectable" ).selectable({
			stop: function() {
				$( ".ui-selected", this ).each(function() {
					var index = $( "#product_line-selectable li" ).index(this);
					var valueid=$( "#product_line-selectable li:eq("+index+")" ).attr("valueid");
					$("#product_line-value").attr("value",valueid);
				});
			}
		});
	});
	$(function() {
	$( "#product_line-selectable li", this ).each(function() {
		var index = $( "#product_line-selectable li" ).index(this);
			var value=$("#product_line-value").attr("value");
			if ( value == $( "#product_line-selectable li:eq("+index+")" ).attr("valueid") )
				{ 
				$( "#product_line-selectable li:eq("+index+")" ).addClass("ui-selected"); 
				}
		});			
	});
	</script>
</td></tr>

<tr><td>国家:</td><td><input type="hidden" name="country" id="country-value" value="{$brand_text.country}" />
<ol id="country-selectable" class="selectable">
{foreach $brand as $value}
{if $value.belongto eq 'country'}
<li class="ui-widget-content" valueid="{$value.id}">{$value.typename}</li>
{/if}
{/foreach}
</ol>
<script>
	$(function() {
		$( "#country-selectable" ).selectable({
			stop: function() {
				$( ".ui-selected", this ).each(function() {
					var index = $( "#country-selectable li" ).index(this);
					var valueid=$( "#country-selectable li:eq("+index+")" ).attr("valueid");
					$("#country-value").attr("value",valueid);
				});
			}
		});
	});
	$(function() {
	$( "#country-selectable li", this ).each(function() {
		var index = $( "#country-selectable li" ).index(this);
			var value=$("#country-value").attr("value");
			if ( value == $( "#country-selectable li:eq("+index+")" ).attr("valueid") )
				{ 
				$( "#country-selectable li:eq("+index+")" ).addClass("ui-selected"); 
				}
		});			
	});
	</script>
</td></tr>

<tr><td>官方网址:</td><td><input type="text" name="website" value="{$brand_text.website}"/></td></tr>
<tr><td>网店地址:</td><td><input type="text" name="webmall" value="{$brand_text.webmall}"/></td></tr>
<tr><td>实体店地址:</td><td><input type="text" name="shop" value="{$brand_text.shop}"/></td></tr>
<tr><td>品牌介绍:</td><td><textarea name="info" >{$brand_text.info}</textarea></td></tr>
<tr><td>背景故事:</td><td><textarea name="background" >{$brand_text.background}</textarea></td></tr>
<script type="text/javascript" >
   $(document).ready(function() {
      $("textarea").markItUp(mySettings);
   });
</script>
<tr><td></td><td><input type="submit" value="提  交" /></td></tr>
</table>
</form>
{if $msg eq 1}<span>品牌添加成功！{elseif $msg eq 2}品牌修改成功！</span>{/if}
</div>






{include file="footer.tpl"}